package com.ruoyi.controller.achievements;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.service.achievements.AcvParameterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
@RequestMapping("/acvParameterManager")
public class AcvParameterController extends BaseController {

    @Autowired
    AcvParameterService acvParameterService;

    private String prefix = "achievements/parameter";

    @GetMapping()
    public String AcvParameterManager() {
        return prefix + "/acvParameterList";
    }

    @RequestMapping("/list")
    @ResponseBody
    public TableDataInfo list(@RequestParam Map map) {
        return getDataTable(acvParameterService.list(map));
    }

    @GetMapping("/edit")
    public String edit(String id, ModelMap mmap) {
        mmap.put("parameter", acvParameterService.findParameterObj(id));
        return prefix + "/edit";
    }

    @RequestMapping("/edit")
    @ResponseBody
    public AjaxResult edit(@RequestParam Map map){
        return toAjax(acvParameterService.edit(map));
    }
}
